package com.tony;

public class VariantTest {
    static int i=10;
    int j=10;

    public VariantTest() {
        i++;
        j++;
        System.out.println("i="+i+";j="+j);
    }
    public void add(){
        System.out.println("add result:"+(i+j));
    }

    static void staticTest(){
        VariantTest test = new VariantTest();
        test.add();
    }

    /**
     * 每次创建时都会分配一个J,所以j的值每次new输出都是一样的,i的值会增加
     * @param args
     */
    public static void main(String[] args) {
//        VariantTest test1 = new VariantTest();
//        VariantTest test2 = new VariantTest();
//        VariantTest test3 = new VariantTest();
        staticTest();
    }
}
